2023 LECS data

Exploratory plots of 2023 LECS data

load libraries and read data

library(tidyverse)
── Attaching packages ─────────────────────────────────────── tidyverse 1.3.2 ──
✔ ggplot2 3.4.0      ✔ purrr   1.0.0 
✔ tibble  3.1.8      ✔ dplyr   1.0.10
✔ tidyr   1.2.1      ✔ stringr 1.5.0 
✔ readr   2.1.3      ✔ forcats 0.5.2 
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
library(mlabtools)
library(scattermore)
library(xts)
Loading required package: zoo

Attaching package: 'zoo'

The following objects are masked from 'package:base':

    as.Date, as.Date.numeric


Attaching package: 'xts'

The following objects are masked from 'package:dplyr':

    first, last
library(dygraphs)

met <- read_csv("data/LECS_2023/surface_met.csv")
Rows: 25508 Columns: 11
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
dbl  (9): hour, min, sec, day, month, year, par, wind_speed, wind_dir
lgl  (1): X10
dttm (1): ts

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
sfc_status <- read_csv("data/LECS_2023/surface_status.csv")
Rows: 181173 Columns: 22
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
dbl  (21): hour, min, sec, day, month, year, vmin, vsec, vday, vhour, vyear,...
dttm  (1): ts

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
sfc_data <- read_csv("data/LECS_2023/surface_data.csv")
Rows: 19094 Columns: 16
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
dbl (16): count, pressure, vx, vy, vz, a1, a2, a3, corr1, corr2, corr3, ana_...

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
ldr_status <- read_csv("data/LECS_2023/lander_status.csv")
Rows: 279891 Columns: 23
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
dbl  (21): hour, min, sec, day, month, year, vmin, vsec, vday, vhour, vyear,...
lgl   (1): empty
dttm  (1): ts

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
ldr_data <- read_csv("data/LECS_2023/lander_data.csv")
Rows: 31310 Columns: 16
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
dbl (16): count, pressure, vx, vy, vz, a1, a2, a3, corr1, corr2, corr3, ana_...

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.

ADV had incorrect RTC setting. Adding an offset to convert to clock time

# time offset in seconds
ts_offset <- 671628945

adv_status <- read_adv_status("data/LECS_2023/LECS_ADV/22.sen", ts_offset)
Rows: 1971617 Columns: 16
── Column specification ────────────────────────────────────────────────────────

chr (7): X1, X2, X4, X5, X6, X7, X8
dbl (9): X3, X9, X10, X11, X12, X13, X14, X15, X16

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.

ADV data

Data stored in internal ADV memory

Battery Voltage

Resampled to 1 min means

bat_ts <- xts(adv_status$bat, order.by = adv_status$timestamp)
bat_ts_res <- period.apply(bat_ts, endpoints(bat_ts, "mins"), FUN = mean)
bat_ts_res <- bat_ts_res[bat_ts_res[,1] < 19,]
dygraph(bat_ts_res) |> 
  dygraphs::dyRangeSelector()

Temperature

Resampled to 1 min means

temp_ts <- xts(adv_status$temp, order.by = adv_status$timestamp)
temp_ts_res <- period.apply(temp_ts, endpoints(temp_ts, "mins"), FUN = mean)
dygraph(temp_ts_res) |> 
  dygraphs::dyRangeSelector()

Met data

PAR

Something’s up with the PAR readings. Is this something electrical related to the 4h transmit cycles?

plot_ts(met, "par", timestamp = "ts")

Wind Speed

Wind speed and direction look OK, if a little noisy

plot_ts(met, "wind_speed", timestamp = "ts")

Wind Dir

plot_ts(met, "wind_dir", timestamp = "ts")

Lander SD Data

Looking at single most recent 1h file.

Missing packets

Estimate missing packet fraction by looking at 0-255 count. Estimated 4% with python.

ldr_data_missing <- ldr_data |> 
  filter(count != 0) |> 
  mutate(missed = ifelse(count == 1, 256 - lag(count), count - 1 - lag(count)))

Fraction missing

sum(ldr_data_missing$missed, na.rm = TRUE) / length(ldr_data_missing$missed)
[1] 0.1151645

pH

ggplot(ldr_data, aes(1:nrow(ldr_data), pH)) +
  geom_line()

Estimate bad packet fraction with pH

ldr_data_bad <- ldr_data |> 
  mutate(bad = (pH > 8.4 | pH < 7.5))

sum(ldr_data_bad$bad) / length(ldr_data_bad$bad)
[1] 0.01721495

pH without bad packets

df <- ldr_data_bad |> 
  filter(!bad)

ggplot(df, aes(1:nrow(df), pH)) +
  geom_line()

DO & temp

These look OK.

ggplot(ldr_data, aes(1:nrow(ldr_data), DO)) +
  geom_line()

ggplot(ldr_data, aes(1:nrow(ldr_data), temp)) +
  geom_line()

Surface SD Status

Data is very noisy. Pretty sure this is due to bad ADV packet reads.

bat_ts <- xts(sfc_status$bat, order.by = sfc_status$ts)
bat_ts_res <- period.apply(bat_ts, endpoints(bat_ts, "mins"), FUN = mean)
bat_ts_res <- bat_ts_res[bat_ts_res[,1] < 13 & bat_ts_res[,1] > 11,] # filter by voltage
bat_ts_res <- bat_ts_res['2023-03-01/2023-11-01'] # filter by time
dygraph(bat_ts_res) |> 
  dygraphs::dyRangeSelector()